NAME = "DHTML"
DATE = $(shell date +"%Y-%m-%d %T")
BASE = $(shell pwd)

HR = \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#

STYLES = ./war/styles
TPL = ./war/tpl
GLOBAL = ./src/global
SCSS = ./src/scss
ICON = ./src/icon

build:
	@echo "${HR}"
	@echo "Building ${NAME}..."

	@sprity create ${GLOBAL} ${ICON}/*.png -c . -n global -p css -s _icon.scss --orientation binary-tree
	@cd ${GLOBAL} && _find . -type f -name '*.png' -exec cp -p --parents {} ${BASE}/${STYLES} \; && cd ${BASE}
	@node-sass --output-style compressed -r ${GLOBAL} -o ${STYLES}

	@rm -rf ${TPL} & mkdir -p ${TPL}

	@gulp webpack --watch false --debug false
	@node-sass --output-style compressed -r ${SCSS} -o ${TPL}

	@mvn clean package

	@echo "${NAME} successfully built at ${DATE}"
	@echo "${HR}"